[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
sets Set of Elements Data Structure
Pascal allows the definition of a set of an ordinal type (Integer
subrange, Char, Boolean, enumerated). No actual values are stored in a
set;, instead, a bit is set indicating whether or not a given value is
currently present in the set. The general format is:
type
<tname> = set of <ord type>;
var
<vname> = set of <ord type>;
where <ord type> is a Char, Boolean, Integer, or enumerated type, such
that it is a subrange with no more than 256 values.
Set operators (including set membership) are defined.
-------------------------------- Example ---------------------------------
type
Days = (Sun,Mon,Tues,Wed,Thur,Fri,Sat);
var
Able : set of Char;
Iota : set of Days;
Fred : set of Byte;
begin
Able := ['B'..'K'];
Iota := [Sun,Tues,Fri];
Fred := [1..3,5,7,11,13,17,19,23,29]
end.
See Also:
set
in
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson